package com.jic.market.mapper.overlay;

import com.jic.market.entity.overlay.OverlayPromotionRule;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 叠加规则活动规则表
 *
 * @author : seven
 * @version : v1.0.0
 * @email : 774329481@qq.com
 * @since : 2020-03-20 04:58:38
 */
@Repository
public interface OverlayPromotionRuleMapper {

    long insert(OverlayPromotionRule overlayPromotionRule);

    long delete(Long id);

    long update(OverlayPromotionRule overlayPromotionRule);

    OverlayPromotionRule queryByPrimaryKey(Long id);

    List<OverlayPromotionRule> query(OverlayPromotionRule overlayPromotionRule);

    List<OverlayPromotionRule> queryPage(@Param("startIndex") int startIndex, @Param("limit") int limit, @Param("overlayPromotionRule") OverlayPromotionRule overlayPromotionRule);

    long queryPageCount(OverlayPromotionRule overlayPromotionRule);

    @Select("select prom_type_target from market_overlay_promotion_rule where prom_type_source = #{promTypeSource} and rule_result != '1' and delete_flag='0' ")
    List<String> queryPromotionRuleBySourcePromTypeAndRuleResult(@Param("promTypeSource")String promTypeSource);

    List<String> queryPromTypeTargetBySourcePromTypeAndPromTypeTargets(@Param("promTypeSource")String promTypeSource, @Param("promTypeTargets")List<String> promTypeTargets);
}